<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>

 
  <link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/dpl.css" rel="stylesheet">
  <link href="http://g.alicdn.com/bui/bui/1.1.21/css/bs3/bui.css" rel="stylesheet">
  <script src="http://g.tbcdn.cn/fi/bui/jquery-1.8.1.min.js"></script>
  <script src="http://g.alicdn.com/bui/seajs/2.3.0/sea.js"></script>
  <script src="http://g.alicdn.com/bui/bui/1.1.21/config.js"></script>
  <style>
  	body{
  		padding:30px;
  	}
  	.row table{
  		margin-left:9px;
  	}
  	.row thead{
  		background:#DFF0D8;
  	}
  	.row table th,.row table td{
  		text-align:center;
  	}
  	.well{
  		background:#DFF0D8;
  		width:97.7%;
  	}
  </style>
 
</head>
<body>

 
 	<div class="well">
 		<form class="" action="<%=basePath%>userShip/show">
 			<input type="text" name="keyword"  class="control-text span-width" placeholder="用户名…">
 			<input type="submit" class="button button-info" value="查询" style="margin-left:30px;">
 		</form> 
 		
 	</div>
 	<center><s:property value="tip"/></center>
	<div class="row">

	    <table  class="table table-bordered">
	      <thead>
	       
	        <tr>
	          <th>用户ID</th>
	          <th>姓名</th>
	          <th>用户所在组</th>
	          <th>操作</th>
	        </tr>
	      </thead>
	      <tbody>
	         <!-- 迭代输出数据 -->
			<s:iterator value="pageInfo.basePageList" var="one">
			<tr>
				<td><s:property value="#one.user.id"/></td>
				<td> <s:property value="#one.user.firstName"/></td>
				<td> <s:property value="#one.groupInfo"/></td>
				<td>
	          	  <button value='<s:property value="#one.user.id"/>' class="updateRight button" style="border:0px;"  ><i class="icon-black icon-edit"></i></button>
	         	</td>
			</tr>
			</s:iterator>
	      </tbody>
	    </table>
	    
	    <div>
	     
	      <div class="pagination pull-right">
	        <ul>
				<!-- 显示总记录数和总页数 -->
				<li class="disabled" style="letter-spacing:2px;">
					<a href="">
						总共<s:property value="pageInfo.rootListSize"/>条/<s:property value="pageInfo.pageCount"/>页
					</a>
				</li>

				<!-- 是否要上一页按钮 -->
				<s:if test="pageInfo.nowPage>1">
					<li class="active">
						<a href="<%= basePath %>userShip/show?targetPage=<s:property value="pageInfo.nowPage - 1"/>">« 上一页</a>
					</li>
				</s:if>
				<s:else>
					<li class="disable">
						<a href="#">« 上一页</a>
					</li>
				</s:else>
				
				<!-- 迭代输出每一页的页号 -->
				<s:iterator value="pageInfo.pageNoList" var="page">
					<!-- 首先确保不是-1 -->
					<s:if test="#page != -1">
						<s:if test="#page != 0">
							<!-- 如果是当前页，特殊颜色显示 -->
							<s:if test="#page == pageInfo.nowPage">
								<li class="active">
									<a href="<%= basePath %>userShip/show?keyword=<s:property value="keyword"/>&targetPage=<s:property value="#page"/>">
										<s:property value="#page"/>
									</a>
								</li>
							</s:if>
							
							<!-- 否则一般颜色显示 -->
							<s:else>
								<li>
									<a href="<%= basePath %>userShip/show?keyword=<s:property value="keyword"/>&targetPage=<s:property value="#page"/>">
										<s:property value="#page"/>
									</a>
								</li>
							</s:else>
						</s:if>
						<s:else>
							<li>
								<a href="<%= basePath %>userShip/show?keyword=<s:property value="keyword"/>&targetPage=1">...</a>
							</li>
						</s:else>
					</s:if>
				</s:iterator>
				
				<!-- 是否需要最后一页的按钮 -->
				<s:if test="pageInfo.pageCount == pageInfo.nowPage">
					<li class="disable">
						<a href="#">下一页 »</a>
					</li>
				</s:if>
				<s:else>
					<li class="active">
						<a href="<%= basePath %>userShip/show?keyword=<s:property value="keyword"/>&targetPage=<s:property value="pageInfo.nowPage + 1"/>">下一页 »</a>
					</li>
				</s:else>
			</ul>
	      </div>
	    </div>
	    
	  </div>



	  <!-- 此节点内部的内容会在弹出框内显示,默认隐藏此节点-->
    <div id="content" class="hidden" style="visibility:hidden;">
      <form id="form" action="<%=basePath%>userShip/edit" class="form-horizontal">
        <div class="row">
          <div class="control-group" style="margin-left:15%;">
            <label class="control-label">用户id：</label>
            <div class="controls">
              <input id="userid" name="uid" value="" readonly="readonly" type="text" class="input-normal control-text">
            </div>
          </div>
          <div class="control-group" >
          <!-- 管理员 -->
           <s:iterator value="groupsMap['1']" var="oneGroup">
         	<label class="control-label checkbox" >
              <input type="radio" name="gid" value="<s:property value="#oneGroup.id"/>"><s:property value="#oneGroup.name"/>
            </label>
          </s:iterator>
             <!-- 行长 -->
           <s:iterator value="groupsMap['3']" var="twoGroup">
         	<label class="control-label checkbox" >
              <input type="radio" name="gid" value="<s:property value="#twoGroup.id"/>"><s:property value="#twoGroup.name"/>
            </label>
          </s:iterator>
             <!-- 职能部门-->
           <s:iterator value="groupsMap['11']" var="threeGroup">
         	<label class="control-label checkbox" >
              <input type="radio" name="gid" value="<s:property value="#threeGroup.id"/>"><s:property value="#threeGroup.name"/>
            </label>
          </s:iterator>
             <!-- 网管中心 -->
           <s:iterator value="groupsMap['4']" var="fourGroup">
         	<label class="control-label checkbox" >
              <input type="radio" name="gid" value="<s:property value="#fourGroup.id"/>"><s:property value="#fourGroup.name"/>
            </label>
          </s:iterator>
             <!-- 网点-->
           <s:iterator value="groupsMap['111']" var="fiveGroup">
         	<label class="control-label checkbox" >
              <input type="radio" name="gid" value="<s:property value="#fiveGroup.id"/>"><s:property value="#fiveGroup.name"/>
            </label>
          </s:iterator>
          </div>
           <div class="control-group" >
             <!-- 公告员 -->
           <s:iterator value="groupsMap['2']" var="sixGroup">
         	<label class="control-label checkbox" >
              <input type="checkbox" name="noticeOfficer" value="<s:property value="#sixGroup.id"/>"><s:property value="#sixGroup.name"/>
            </label>
          </s:iterator>
          </div>
        </div>
      </form>
    </div>

 
<!-- 添加 script start --> 
    <script type="text/javascript">
        BUI.use(['bui/overlay','bui/form'],function(Overlay,Form){
    var value="";
      var form = new Form.HForm({
        srcNode : '#form'
      }).render();
 
      var dialog = new Overlay.Dialog({
            title:'修改用户所在组',
            width:600,
            height:250,
            //配置DOM容器的编号
            contentId:'content',
            success:function () {
              $("#form").submit();
            }
          });
        
        $('.updateRight').on('click',function () {
          value=this.value;
          $("#userid").val(value);
          dialog.show();
        });
       

      });
    </script>
<!-- script end -->


</body>
</html>